classdef UtilityFunction < handle
    
    properties
        epsilon
        xi
    end
    
    methods
        
        function self = UtilityFunction(epsilon, xi)
            self.epsilon = epsilon;
            self.xi = xi;
        end

        
        function out = l(self,w)
        % labor supply as function of the net-wage w
            out = (self.xi.*w).^self.epsilon;
        end

        
        function out = U(self,c,l)
        % utility function
            out = c-1/self.xi.*l.^(1+1/self.epsilon)./(1+1/self.epsilon);
        end

        
        function out = dUdl(self,l)
            out = -1/self.xi.*l.^(1/self.epsilon);
        end

        
        function out = mtax(self,l,w)
            out = 1+self.dUdl(l)./w;
        end

        
        function out = Udot(self,l,w)
            out = -self.dUdl(l).*l./w;
        end

        
        function out = c(self,V,l)
        % consumption as function of indirect utility V and labor
        % supply l
            out = V+1/self.xi.*l.^(1+1/self.epsilon)./(1+1/self.epsilon);
        end

     
        
    end
end